home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_b / tlgame.act < prev    next >
Text File  |  1995-04-22  |  10KB  |  382 lines

  1. ;*********************************** 
  2. ;*       THREE LETTER GAME         * 
  3. ;*                                 * 
  4. ;*      adapted for  ACTION!       * 
  5. ;*              by                 * 
  6. ;*         Gary Lee Evans          * 
  7. ;*          San Jose, CA           * 
  8. ;*********************************** 
  9.       
  10. BYTE y1,y2,y3,c1,c2,c3,d1,d2,d3, 
  11.      a,h,hits,flag,eflag,guesses, 
  12.      time,time1,x 
  13. CARD j,l,s,t,a1,numwords  
  14. BYTE ARRAY words=[00 
  15. 65 67 69 65 67 84 65 68 69 65 68 79 65 68 83 65 70 84 65 71 69  
  16. 65 71 79 65 73 68 65 73 76 65 73 77 65 73 82 65 76 69 65 76 80  
  17. 65 78 68 65 78 84 65 78 89 65 80 69 65 80 84 65 82 67 65 82 69  
  18. 65 82 75 65 82 77 65 82 84 65 83 72 65 83 75 65 83 80 65 84 69  
  19. 65 87 69 65 87 76 65 88 69 65 89 69 66 65 68 66 65 71 66 65 78  
  20. 66 65 82 66 65 84 66 65 89 66 69 68 66 69 71 66 69 84 66 73 68  
  21. 66 73 71 66 73 78 66 73 84 66 79 65 66 79 71 66 79 87 66 79 88  
  22. 66 79 89 66 85 68 66 85 71 66 85 77 66 85 78 66 85 83 66 85 84  
  23. 66 85 89 66 89 69 67 65 66 67 65 68 67 65 77 67 65 78 67 65 80  
  24. 67 65 82 67 65 84 67 79 66 67 79 68 67 79 71 67 79 78 67 79 80  
  25. 67 79 84 67 79 87 67 79 89 67 82 89 67 85 66 67 85 68 67 85 69  
  26. 67 85 80 67 85 82 67 85 84 68 65 66 68 65 77 68 65 89 68 69 78  
  27. 68 69 87 68 73 69 68 73 71 68 73 77 68 73 78 68 73 80 68 79 69  
  28. 68 79 71 68 79 78 68 79 84 68 82 89 68 85 66 68 85 69 68 85 71  
  29. 68 89 69 68 85 79 69 65 82 69 65 84 69 71 79 69 76 75 69 76 77  
  30. 69 78 68 69 76 70 69 82 65 70 65 68 70 65 71 70 65 78 70 65 82  
  31. 70 65 84 70 69 68 70 69 87 70 73 71 70 73 78 70 73 82 70 73 84  
  32. 70 73 88 70 76 89 70 79 69 70 79 71 70 79 82 70 79 88 70 82 89  
  33. 70 85 78 70 85 82 71 65 80 71 65 83 71 65 89 71 69 77 71 69 84  
  34. 71 73 78 71 78 85 71 79 66 71 79 68 71 79 84 71 85 77 71 85 78  
  35. 71 85 84 71 85 89 71 89 80 72 65 68 72 65 71 72 65 77 72 65 83  
  36. 72 65 84 72 65 89 72 69 78 72 69 88 72 73 68 72 73 77 72 73 80  
  37. 72 73 83 72 73 84 72 69 82 72 69 77 72 79 69 72 79 71 72 79 80  
  38. 72 79 84 72 79 87 72 85 66 72 85 69 72 85 71 72 85 77 72 85 84  
  39. 73 67 69 73 67 89 73 76 75 73 78 75 73 77 80 73 79 78 73 82 69  
  40. 73 82 75 73 84 83 73 86 89 74 65 66 74 65 82 74 65 87 74 65 89  
  41. 74 79 66 74 79 71 74 79 84 74 79 89 74 85 71 74 65 71 74 65 77  
  42. 74 69 84 74 73 66 74 73 71 74 85 84 75 69 71 75 69 89 75 73 68  
  43. 75 73 78 75 73 84 76 65 66 76 65 68 76 65 71 76 65 80 76 65 87  
  44. 76 65 89 76 65 88 76 69 68 76 69 71 76 69 84 76 73 68 76 73 69  
  45. 76 73 80 76 73 84 76 79 66 76 79 71 76 79 80 76 79 84 76 79 87  
  46. 76 89 69 77 65 68 77 65 78 77 65 80 77 65 82 77 65 84 77 65 89  
  47. 77 69 78 77 69 84 77 73 68 77 79 66 77 79 80 77 79 87 77 85 68  
  48. 77 73 88 77 85 71 78 65 66 78 65 71 78 65 80 78 65 89 78 69 84  
  49. 78 69 87 78 73 76 78 73 80 78 79 68 78 79 84 78 79 82 78 79 87  
  50. 78 85 84 79 65 70 79 65 75 79 65 82 79 65 84 79 68 69 79 73 76  
  51. 79 76 68 79 78 69 79 80 84 79 82 69 79 85 82 79 85 84 79 86 65  
  52. 79 87 69 79 87 76 79 87 78 80 65 68 80 65 76 80 65 78 80 65 82  
  53. 80 65 84 80 65 87 80 65 89 80 69 65 80 69 71 80 69 78 80 69 84  
  54. 80 69 87 80 73 69 80 73 71 80 73 84 80 76 89 80 79 68 80 79 84  
  55. 80 79 88 80 69 82 80 73 78 80 82 79 80 82 89 80 85 66 80 85 78  
  56. 80 85 83 80 85 84 82 65 71 82 65 77 82 65 78 82 65 80 82 65 84  
  57. 82 65 87 82 65 89 82 69 68 82 73 66 82 73 68 82 69 86 82 73 71  
  58. 82 73 77 82 73 80 82 79 66 82 79 68 82 79 69 82 79 84 82 79 87  
  59. 82 85 66 82 85 69 82 85 71 82 85 77 82 85 78 82 85 84 82 89 69  
  60. 83 65 68 83 65 71 83 65 80 83 65 84 83 65 87 83 65 89 83 69 84  
  61. 83 69 87 83 69 88 83 72 89 83 69 65 83 73 78 83 72 69 83 73 80  
  62. 83 73 82 83 73 84 83 73 88 83 75 73 83 75 89 83 76 89 83 79 66  
  63. 83 79 68 83 79 78 83 79 87 83 79 89 83 80 65 83 80 89 83 84 89  
  64. 83 85 69 83 85 77 83 85 78 84 65 66 84 65 68 84 65 71 84 65 78  
  65. 84 65 80 84 65 88 84 65 82 84 69 65 84 73 78 84 72 69 84 72 89  
  66. 84 73 67 84 73 69 84 73 78 84 73 80 84 79 69 84 79 78 84 79 80  
  67. 84 79 87 84 79 89 84 82 89 84 85 66 84 85 71 84 87 79 85 82 78  
  68. 85 83 69 85 80 83 86 65 78 86 65 84 86 69 88 86 73 65 86 73 69  
  69. 86 73 77 86 79 87 89 65 75 89 65 77 89 69 78 89 69 83 89 69 84  
  70. 89 79 85 87 65 68 87 65 71 87 65 78 87 65 82 87 65 83 87 65 88  
  71. 87 65 89 87 69 66 87 69 68 87 69 84 87 72 79 87 72 89 87 73 71  
  72. 87 73 78 87 73 84 87 79 69 87 79 78 87 82 89 90 73 80 70 73 66  
  73. 83 69 69 69 89 69 65 76 76] 
  74.    
  75. CARD FUNC Delay(BYTE time) 
  76. BYTE time2 
  77.      FOR time1=1 TO time  
  78.        DO 
  79.         FOR time2=1 TO 150 
  80.          DO OD 
  81.         Sound(0,time1,10,4) 
  82.        OD 
  83.      Sound(0,0,0,0) 
  84. RETURN (0) 
  85.   
  86.   
  87. BYTE FUNC Getkey() 
  88.   DO 
  89.      a=GetD(7) 
  90.      IF a>64 AND a<91 
  91.      THEN EXIT 
  92.      FI 
  93.   OD 
  94. RETURN(a) 
  95.   
  96.   
  97. PROC Guess() 
  98. ; Allows you to enter a three 
  99. ; letter word  
  100.   
  101.  DO  
  102.    Position(x,23) 
  103.    y1=Getkey() Put(y1) 
  104.    y2=Getkey() Put(y2) 
  105.    y3=Getkey() Put(y3) 
  106.    a=GetD(7) 
  107.      IF a=155 THEN 
  108.         EXIT 
  109.      FI  
  110.  OD 
  111. RETURN 
  112.   
  113.   
  114. BYTE FUNC Checkit() 
  115. ; Checks your input to make sure 
  116. ; that you entered a legal word 
  117.   
  118.   flag=0 
  119.   FOR a1=0 TO numwords*3 STEP 3 
  120.      DO 
  121.         IF words(a1+1)=y1 
  122.            AND words(a1+2)=y2 
  123.            AND words(a1+3)=y3 
  124.            THEN flag=1 
  125.         FI 
  126.      OD 
  127. RETURN (flag) 
  128.   
  129.   
  130. BYTE FUNC Fighits() 
  131. ; Checks to see how many letters 
  132. ; match your word and computers 
  133. ; word 
  134.   
  135.   h=0 
  136.    IF y1=c1 AND 
  137.       y2=c2 AND 
  138.       y3=c3 THEN 
  139.       RETURN (4) 
  140.    FI 
  141.    IF  y1=c1 OR         
  142.        y1=c2 OR 
  143.        y1=c3 THEN 
  144.        h==+1 
  145.    FI 
  146.    IF  y2=c1 OR         
  147.        y2=c2 OR 
  148.        y2=c3 THEN 
  149.        h==+1 
  150.    FI 
  151.    IF  y3=c1 OR         
  152.        y3=c2 OR 
  153.        y3=c3 THEN 
  154.        h==+1 
  155.    FI 
  156. RETURN (h) 
  157.   
  158. PROC Error() 
  159. eflag=1 
  160. FOR a=1 TO 6  
  161.   DO 
  162.     Position(2,23) 
  163.     Print("SOMETHINGS WRONG !!        ") 
  164.     Delay(100) 
  165.     Position(2,23) 
  166.     Print("SOMETHINGS WRONG !!        ") 
  167.     Delay(50) 
  168.   OD 
  169. Position(2,23) 
  170. Print("What's your secret word:    ") 
  171. x=27 
  172. Guess() 
  173. a=Checkit() 
  174.   IF a=0 THEN 
  175.      Position(2,23) 
  176.      Print("Illegal word - I had no chance") 
  177.      Delay(250) Delay(250) 
  178.   FI 
  179.   IF a=1 THEN 
  180.      Position(2,23) 
  181.      Print("You gave a bad answer somewhere?") 
  182.      Delay(250) Delay(250) 
  183.   FI 
  184. RETURN 
  185.   
  186.   
  187. CARD FUNC Moveword(CARD s,CARD t) 
  188. BYTE c4,c5,c6  
  189.   
  190. c1=words((t)*3+1) 
  191. c2=words((t)*3+2) 
  192. c3=words((t)*3+3) 
  193. c4=words((s-1)*3+1) 
  194. c5=words((s-1)*3+2) 
  195. c6=words((s-1)*3+3) 
  196. words((s-1)*3+1)=c1 
  197. words((s-1)*3+2)=c2 
  198. words((s-1)*3+3)=c3 
  199. words((t)*3+1)=c4 
  200. words((t)*3+2)=c5 
  201. words((t)*3+3)=c6 
  202. RETURN (0) 
  203.   
  204.   
  205. PROC Think() 
  206. j=0 
  207. l==-1 
  208.   IF l<1 THEN Error() FI 
  209.     DO 
  210.       IF eflag=1 THEN EXIT FI 
  211.       DO 
  212.         j==+1 
  213.         IF j-1=l THEN RETURN FI 
  214.         c1=words((j-1)*3+1) 
  215.         c2=words((j-1)*3+2) 
  216.         c3=words((j-1)*3+3) 
  217.         h=Fighits() 
  218.         IF hits<>h THEN EXIT FI 
  219.       OD 
  220.     s=j t=l-1 
  221.     Moveword(s,t) 
  222.     l==-1 
  223.       IF l<1 THEN Error() FI 
  224.       IF eflag=1 THEN EXIT FI 
  225.     flag=0 
  226.       IF l>j-1 THEN flag=1 
  227.          j==-1 
  228.       FI 
  229.       UNTIL flag=0 
  230.     OD 
  231. RETURN 
  232.   
  233.   
  234. PROC Getword() 
  235.   
  236.  s=numwords 
  237.   WHILE s>2 
  238.    DO 
  239.      t=Rand(s)+1 
  240.      Moveword(s,t) 
  241.      s==-2 
  242.    OD 
  243.   t=Rand(numwords)+1 
  244.   d1=words(t*3+1) 
  245.   d2=words(t*3+2) 
  246.   d3=words(t*3+3) 
  247. RETURN 
  248.   
  249.   
  250. BYTE FUNC Main() 
  251.   l=numwords 
  252.   Getword() 
  253.   guesses=0 
  254.     DO 
  255.      guesses==+1 
  256.       DO 
  257.        Position(2,23) 
  258.        Print("Enter your guess:       ") 
  259.        x=20 
  260.         Guess() 
  261.         c1=d1 
  262.         c2=d2 
  263.         c3=d3 
  264.         a=Checkit() 
  265.            IF a=1 THEN EXIT FI 
  266.            FOR a=1 TO 5  
  267.              DO 
  268.                Position(2,23) 
  269.                Put(y1) Put(y2) Put(y3) 
  270.                Print(" isn't a legal word") 
  271.                Delay(100) 
  272.                Position(2,23) 
  273.                Put(y1+128) Put(y2+128) 
  274.                Put(y3+128) 
  275.                Delay(50) 
  276.              OD 
  277.       OD 
  278.      Position(4,guesses+5) 
  279.      Put(y1) Put(y2) Put(y3) 
  280.      Print("   ") 
  281.      hits=Fighits() 
  282.      PrintB(hits) 
  283.        IF hits=4 THEN RETURN(2) FI 
  284.      Position(2,23) 
  285.      Print("Okay..                ")  
  286.      Delay(250) 
  287.      y1=words((l-1)*3+1) 
  288.      y2=words((l-1)*3+2) 
  289.      y3=words((l-1)*3+3) 
  290.      Position(2,23) 
  291.      Print("My guess is: ") 
  292.      Put(y1) Put(y2) Put(y3) 
  293.      Position(26,guesses+5) 
  294.      Put(y1) Put(y2) Put(y3) 
  295.      Delay(